

IMPLEMENTATION MODULE Tad_Par;

FROM Storage  IMPORT ALLOCATE, DEALLOCATE;
FROM SYSTEM   IMPORT TSIZE;
FROM StrIO    IMPORT WriteString, WriteLn; 
FROM NumberIO IMPORT WriteInt; 
FROM FpuIO IMPORT WriteReal;


TYPE 
     Par = POINTER TO P;

	 P = RECORD
		 x : INTEGER;
		 y : REAL; 
	  END;


PROCEDURE Par_Crear (a: INTEGER; b : REAL) : Par;
VAR ele : Par ;
BEGIN
   NEW(ele);

   IF (ele = NIL) THEN
      RETURN NIL;
   END;

   ele^.x := a;
   ele^.y := b;

   RETURN ele;
END Par_Crear;

PROCEDURE Imprimir (ee : Par) ;
VAR e : Par;
BEGIN
   e := ee;

   IF e = NIL THEN
       WriteString("NIL");
       RETURN;
   END;

   WriteString("(");
   WriteInt(e^.x, 2);
   WriteString(", ");
   WriteReal(e^.y, 3,0);
   WriteString(")");
   
END Imprimir;

PROCEDURE GetX (e : Par):INTEGER;
BEGIN
	IF e = NIL THEN
       RETURN -1;
   END;
   RETURN e^.x;
END GetX;

PROCEDURE GetY (e : Par):REAL;
BEGIN
	IF e = NIL THEN
       RETURN -1.0;
   END;
   RETURN e^.y;
END GetY;

END Tad_Par.
